package com.campus.food.model.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 菜品实体类
 * 对应数据库表：t_food
 * 
 * @author Claude3.7 Sonnet
 * @since 2025-05-29
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class Food {
    
    /**
     * 菜品ID
     */
    private Long id;
    
    /**
     * 商家ID
     */
    private Long merchantId;
    
    /**
     * 菜品名称
     */
    private String name;
    
    /**
     * 菜品价格
     */
    private BigDecimal price;
    
    /**
     * 菜品描述
     */
    private String description;
    
    /**
     * 菜品图片URL
     */
    private String image;
    
    /**
     * 菜品状态：0-下架，1-上架
     */
    private Integer status;
    
    /**
     * 菜品分类
     */
    private String category;
    
    /**
     * 销量
     */
    private Integer sales;
    
    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    
    /**
     * 更新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
    
    /**
     * 菜品状态枚举
     */
    public enum Status {
        OFF_SHELF(0, "下架"),
        AVAILABLE(1, "上架");
        
        private final Integer code;
        private final String desc;
        
        Status(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }
        
        public Integer getCode() {
            return code;
        }
        
        public String getDesc() {
            return desc;
        }
    }
} 